import 'package:get/get.dart';

import '../../../bean/bean_train.dart';
import '../model/evaluate_model.dart';
import '../model/train_model.dart';

class TrainHistoryController extends GetxController
    with EvaluateModel, TrainModel {
  List<SignRecoderBean> _list;
  bool _isLoading = true;

  int trainId;

  TrainHistoryController(this.trainId);

  bool getIsLoading() {
    return _isLoading;
  }

  List<SignRecoderBean> getList() {
    return _list;
  }

  Future<bool> requestListFunction({bool click = false}) async {
    _isLoading = true;
    if (click) {
      update(["root"]);
    }
    _list = await getUserTrainSignRecoderList(trainId: trainId);
    _isLoading = false;
    update(["root"]);
    return true;
  }

  ///------------------------------------------------------------------------------------------

  bool _isTrainDetailLoading = true;
  TrainBean _trainBean;

  TrainBean getContentTrainBean() {
    return _trainBean;
  }

  bool getTrainDetailLoading() {
    return _isTrainDetailLoading;
  }

  Future<bool> getMyTrainDetailsFunction({bool click = false}) async {
    if (click) {
      update(["root"]);
    }
    _trainBean = await getTrainNetDatils2(trainId: trainId);
    _isTrainDetailLoading = false;
    update(["root"]);
    return Future.value(true);
  }
}
